//
//  LHAreaCollectionViewCell.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/19.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHAreaCollectionViewCell.h"

@implementation LHAreaCollectionViewCell
- (void)dealloc
{
    [_areaPic release];
    [_areaName release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self creatView];
    }
    return self;
}

- (void)creatView
{
    self.areaPic = [[UIImageView alloc]init];
    [self.contentView addSubview:_areaPic];
    [_areaPic release];
    
    self.areaName = [[UILabel alloc]init];
    _areaName.textColor = [UIColor colorWithRed:0.383 green:0.719 blue:0.904 alpha:1.000];
    [_areaName setFont:[UIFont systemFontOfSize:13]];
    _areaName.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_areaName];
    [_areaName release];
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [_areaPic setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 20)];
    
    [_areaName setFrame:CGRectMake(self.frame.size.width / 2 - 50, _areaPic.frame.size.height + 5, 100, 20)];
}

@end
